<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.zmht.specedu.vo.Fengongtype"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	/**
	 * @author 张天兴
	 * @since 2009/05/08
	 */

 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030" />
<title>聋校备课与语言学习及矫治系统</title>
<link href="<%=request.getContextPath() %>/reference/datePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<%=request.getContextPath() %>/reference/js/jquery.js"></script>
<script src="<%=request.getContextPath() %>/reference/WebCalendar.js" type="text/javascript"></script>

<fmt:setBundle basename="PathResource" scope="session" />
<link href="<%=request.getContextPath()%>/<fmt:message key='StylePath' />style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="<fmt:message key='datePicker' />WdatePicker.js"></script>
<script src="<%=request.getContextPath()%>/<fmt:message key='JavaScriptPath' />validate.js"></script>
<script type="text/javascript">

function chooseitem()
{
  
  var sel1=document.studentForm.select1;
  var sel2=document.studentForm.select2;
  
  var ops=sel1.options;
  for(var i=0;i<sel1.options.length;i++){
	if(sel1.options[i].selected){
		sel2.options.add(new Option(sel1.options[i].text,sel1.options[i].value));
  		sel1.options.remove(i);
  		i=i-1;
	}
  }
}

function cancelitem()
{
  var sel1=document.studentForm.select1;
  var sel2=document.studentForm.select2;
  
  var op=sel2.options;
  for(var i=0;i<sel2.options.length;i++){
	if(sel2.options[i].selected){
		sel1.options.add(new Option(sel2.options[i].text,sel2.options[i].value));
  		sel2.options.remove(i);
  		i=i-1;
	}
  }  
  
}
function chooseallitem()
{
  var sel1=document.studentForm.select1;
  var sel2=document.studentForm.select2;
  
  for(k=0;k<sel1.length;k++)
  {
   var op=sel1.options[k];
   sel2.options.add(new Option(op.text,op.value));
  }
  sel1.length=0;
}
function cancelallitem()
{

  var sel1=document.studentForm.select1;
  var sel2=document.studentForm.select2;
  
  for(k=0;k<sel2.length;k++)
  {
   var op=sel2.options[k];
   sel1.options.add(new Option(op.text,op.value));
  }
  sel2.length=0;
}
function check(obj) {
 if(document.forms[0].sname.value==""){
   alert("请输入学生姓名！");
	document.forms[0].sname.focus();
	return false;
	}			
  var var1=document.forms[0].sname.value;
	var parten = /^\s*$/ ;
	if(parten.test(var1)){
	alert("输入的学生姓名不正确！");
	document.forms[0].sname.focus();
	return false;
			}
  if(document.forms[0].sbirthday.value==""){
   alert("请选择出生年月！");
	document.forms[0].sbirthday.focus();
	return false;
	}	
  
  if(document.forms[0].joinSchool.value==""){
   alert("请选择入学日期！");
	document.forms[0].joinSchool.focus();
	return false;
	}	
  if(document.forms[0].leftEar.value==""){
   alert("助听设备不能为空,请选择助听设备！");
	document.forms[0].leftEar.focus();
	return false;
	}	
  
  if(document.forms[0].anzhiState.value==""){
   alert("安置状态不能为空,请选择安置状态！");
	document.forms[0].anzhiState.focus();
	return false;
	}	         
  
   var remark=document.forms[0].remark.value;  
			 if(remark.length>200){
	             alert("其他说明格式不正确,只允许200字以内!");
	             return false;
	             }		       
  
   var classNumber=document.forms[0].classID.value;  
   var select2=document.forms[0].select2.length; 
   if(classNumber==0 && select2==0){
   alert("集体班级和单训班，至少选择一个！");
	document.forms[0].classID.focus();
	return false;
	}
	      
  var sel2=document.studentForm.select2;
  for(k=0;k<sel2.length;k++)
  {
   var op=sel2.options[k];
   op.selected=true;
  }
  
 // alert(1);
  return Validator.Validate(obj,3);
 }
 
//
function ComputeInterval(obj){//计算实际年龄

    var strFirstDate = obj.value;
		if(strFirstDate=="") return;
	var timeParts = strFirstDate.split("-");
	//====================================================================================
	var FirstDate_Year = parseInt(timeParts[0]);
	
	var FirstDate_Month = parseInt(timeParts[1])-1;//Date对象中月份值为:0,1....11
	
	var FirstDate_Date = parseInt(timeParts[2]);
	
	var FirstDate = new Date(FirstDate_Year,FirstDate_Month,FirstDate_Date);
	
	var FirstDate_Time = FirstDate.getTime();
	
	//====================================================================================
	var SecondDate_Time = new Date().getTime();

	//====================================================================================
	var IntervalTime = SecondDate_Time - FirstDate_Time;//两个日期相差的毫秒数 一天86400000毫秒
	var Inter_Days = (IntervalTime/86400000).toFixed(2);
	if(Inter_Days>365){
		var Inter_year = parseInt(Inter_Days/365);
		var Inter_fix = Inter_Days - Inter_year*365;
		var month_day = 365/12;
		var Inter_month = Math.round(Inter_fix/month_day);
		document.forms[0].sage.value= Inter_year + "岁" + Inter_month + "个月";
	}else{
		var month_day = 365/12;
		var Inter_month = Math.round(Inter_Days/month_day);
		document.forms[0].sage.value= Inter_month + "个月";
	}
}
</script>
</head>
<body class="bcolor">
<html:form   method="post" action="studentAction.do" onsubmit="return check(this);">
<input type=hidden name="method" value="save" />
  
  <table cellspacing="0" cellpadding="0" width="99%" align="center" border="0">
    <tbody>
      <tr>
        <td width="7"><img height="38" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_01.gif" 
      width="7" /></td>
        <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_05.gif"><table cellspacing="0" cellpadding="0" width="100%" border="0">
            <tbody>
              <tr>
                <td width="30"><img height="38" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_02.gif" 
            width="30" /></td>
                <td align="left" width="200"   background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_03.gif">&nbsp;<b>增 加 学 生</b></td>
                <td width="59"><img height="38" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_04.gif"    width="59" /></td>
                <td>&nbsp;</td>
              </tr>
            </tbody>
        </table></td>
        <td width="8"><img height="38" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_06.gif" 
      width="8" /></td>
      </tr>
      <tr>
        <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_07.gif"><img height="1" 
      src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />spacer.gif" width="1" /></td>
        <td bgcolor="#f7fbff"><table cellspacing="0" bordercolordark="#ccccff" cellpadding="0" width="100%" bordercolorlight="#ffffff" border="0">
            <tbody>
              <tr bgcolor="#a4c9ec">
                <td align="middle"><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">学生姓名：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="sname" type="text" class="boxcopy2" id="textfield" maxlength="16" style="width:100px;"/>
                    <span class="STYLE4">*</span></td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">性 别：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input type="radio" name="sex" id="radio" value="男" checked/>
                      男
                      <input type="radio" name="sex" id="radio2" value="女" />
                      女</td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">出生日期：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                  <input name="sbirthday" type="text"  id="sbirthday" 
						class="Wdate" onClick="SelectDate(this,'yyyy-MM-dd')" onpropertychange="ComputeInterval(this)" style="width:100px;" maxlength="4"  readOnly="true"  /> 
                    <span class="STYLE4">*</span></td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">实际年龄：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                    <input name="sage" type="text"  id="sage"   class="boxcopy2" readOnly="true"   style="width:100px;"/>
                      <span class="STYLE4">*</span></td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">入学时间：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                    <input name="joinSchool" type="text"  id="textfield18" 
						class="Wdate" onClick="SelectDate(this,'yyyy-MM-dd')"  style="width:100px;" maxlength="4"  readOnly="true"  />
                    <span class="STYLE4">*</span></td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">班级：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                  <html:select property="classID" styleClass="boxcopy2"  style="width:104px;">
                             <option value="0">请选择班级</option>
                             <html:optionsCollection name="classlist" label="gradeAndClassNumber" value="classId"/>                                     
                  </html:select>
                    </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" rowspan="2" align="right" valign="middle" bgcolor="#e6f0f8">助听设备配戴情况：</td>
                    <td width="15%" height="20" align="right" valign="middle" bgcolor="#F2F2F2">左 耳：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                            <html:select property="leftEar" styleClass="boxcopy2"  style="width:104px;">
                             <html:optionsCollection name="listenlist" label="name" value="id"/>
                             </html:select>
                             <span class="STYLE4">*</span>                   
                      </td>
                  </tr>
                  <tr>
                    <td height="20" align="right" valign="middle" bgcolor="#F2F2F2">右 耳：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                             <html:select property="rightEar" styleClass="boxcopy2"  style="width:104px;">
                             <html:optionsCollection name="listenlist" label="name" value="id"/>
                             </html:select>
                             <span class="STYLE4">*</span>
                    </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" rowspan="4" align="right" valign="middle" bgcolor="#e6f0f8">最近一次评估成绩：</td>
                    <td width="15%" height="20" align="right" valign="middle" bgcolor="#F2F2F2">听觉评估：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="listen" type="text" class="boxcopy2" id="textfield12" maxlength="90" style="width:100px;"/></td>
                  </tr>
                  <tr>
                    <td height="20" align="right" valign="middle" bgcolor="#F2F2F2">语言评估：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="language" type="text" class="boxcopy2" id="textfield13" maxlength="90" style="width:100px;"/></td>
                  </tr>
                  <tr>
                    <td height="20" align="right" valign="middle" bgcolor="#F2F2F2">学习能力评估：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="study" type="text" class="boxcopy2" id="textfield14" maxlength="90" style="width:100px;"/></td>
                  </tr>
                  <tr>
                    <td height="20" align="right" valign="middle" bgcolor="#F2F2F2">格雷菲斯评估：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="geleifisi" type="text" class="boxcopy2" id="textfield15" maxlength="500" style="width:100px;"/></td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">监护人：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="nurse" type="text" class="boxcopy2" id="textfield16" maxlength="15" style="width:100px;"/></td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">监护人与学生的关系：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                    <select name="relation" class="boxcopy2" id="select4" style="width:104px;">
                      <option value="父子">父子</option>
                      <option value="父女">父女</option>
                      <option value="母子">母子</option>
                      <option value="母女">母女</option>
                      <option value="其他">其他</option>
                                        </select>
                                        </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">联系电话：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><input name="phone" type="text" class="boxcopy2" id="textfield17"   maxlength="18" style="width:100px;"/>
                    (如：010-66583266)
                    </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">安置状态：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF">
                  <html:select property="anzhiState" styleClass="boxcopy2"  style="width:104px;">
                    <html:optionsCollection name="anzhilist" label="name" value="id"/>                    
                    </html:select>
                    <span class="STYLE4">*</span>
                    </td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="20%" height="20" align="right" valign="middle" bgcolor="#e6f0f8">其他说明：</td>
                    <td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><textarea name="remark" rows="5" class="boxcopy2" id="textfield31" style="width:84%;" onpropertychange="if(value.length>125) value=value.substr(0,125)"></textarea>
                    (200字以内)</td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td height="1" bgcolor="#ffffff"></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td height="20" align="right" valign="middle" bgcolor="#e6f0f8"><p align="center"><strong>选择单训组</strong></p></td>
                  </tr>
                </table></td>
              </tr>
              <tr bgcolor="#ffffff">
                <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#a4c9ec" class="fontbot">
                  <tr>
                    <td width="40%" height="20" align="right" valign="middle" bgcolor="#FFFFFF"><table width="200" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td align="center"><strong>未被选择的单训组名称</strong></td>
                      </tr>
                      <tr>
                        <td align="right">
                        <html:select property="select1" styleClass="boxcopy2"  style="width:200px;" multiple="8" size="6">
                             <html:optionsCollection name="danxunlist" label="name" value="onlyClassId"/>
                        </html:select>
                        </td>
                      </tr>
                    </table>                    </td>
                    <td width="20%" height="20" align="center" valign="middle" bgcolor="#E6F0F8"><table width="100%" border="0" cellspacing="10" cellpadding="0">
                        <tr>
                          <td align="center"><a href="javascript:chooseitem();" onfocus="this.blur()"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />gif-04.gif" width="63" height="22" border="0" /></a></td>
                        </tr>
                        <tr>
                          <td align="center"><a href="javascript:cancelitem();" onfocus="this.blur()"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />gif-05a.gif" width="63" height="22" border="0" /></a></td>
                        </tr>
                        <tr>
                          <td align="center"><a href="javascript:chooseallitem();" onfocus="this.blur()"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />gif-06.gif" width="63" height="22" border="0" /></a></td>
                        </tr>
                        <tr>
                          <td align="center"><a href="javascript:cancelallitem();" onfocus="this.blur()"> <img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />gif-07.gif" width="63" height="22" border="0" /></a></td>
                        </tr>
                    </table></td>
                    <td width="40%" align="left" valign="middle" bgcolor="#FFFFFF"><table width="200" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td align="center"><strong>已被选择的单训组名称</strong></td>
                        </tr>
                        <tr>
                          <td align="right">
                          <select name="select2" multiple size="6" class="boxcopy2"  style="width:200px;"></select>
                          </td>
                        </tr>
                      </table></td>
                  </tr>
                </table></td>
              </tr>
            </tbody>
          </table>
        <table cellspacing="1" cellpadding="0" width="100%" bgcolor="#ffffff" 
        border="0">
              <tbody>
                <tr>
                  <td align="middle" bgcolor="#e6f0f8"><table cellspacing="0" cellpadding="3" width="100%" border="0">
                      <tbody>
                        <tr>
                          <td width="50%" align="right"><input type="image" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />gif-01.gif" width="53" height="22" border="0" /></td>
                          <td width="50%" align="left"><a href="javascript:document.forms[0].reset();" onfocus="this.blur()"><img src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />gif-02.gif" width="53" height="22" border="0" /></a></td>
                        </tr>
                      </tbody>
                  </table></td>
                </tr>
              </tbody>
          </table></td>
        <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_09.gif"><img height="1" 
      src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />spacer.gif" width="1" /></td>
      </tr>
      <tr>
        <td><img height="22" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_10.gif" width="7" /></td>
        <td background="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_11.gif">&nbsp;</td>
        <td><img height="22" alt="" src="<%=request.getContextPath() %>/<fmt:message key='CommonImagePath' />table_1_12.gif" 
  width="8" /></td>
      </tr>
    </tbody>
  </table>
  
</html:form>
</body>
</html>


 